package cn.roadtrip.utilmodule.util.enumpck;

/**
 * 用户角色类型
 */
public enum Enum_UserRoleType {
    Normal("Normal", "普通用户"),
    Dealer("Dealer", "核销员"),
    Leader("Leader", "领队"),
    Worker("Worker", "工作员"),
    AgentUser("AgentUser", "代理商"),
    DriverLeader("DriverLeader", "司机兼领队")
    ;

    private String s;
    private String title;

    Enum_UserRoleType(String s, String title) {
        this.s = s;
        this.title = title;
    }
    Enum_UserRoleType(String s) {
        this.s = s;
        this.title = Enum_UserRoleType.parseCode(s).getTitle();
    }

    public String getTitle() {
        return this.title;
    }

    public String getCode() {
        return this.s;
    }

    public static final Enum_UserRoleType parseCode(String code) {
        switch (code) {
            case "Normal":
                return Normal;
            case "Dealer":
                return Dealer;
            case "Leader":
                return Leader;
            case "Worker":
                return Worker;
            case "AgentUser":
                return AgentUser;
            case "DriverLeader":
                return DriverLeader;
        }
        return null;
    }

    @Override
    public String toString() {
        return "(code:%s, title:%s)".formatted(this.s, this.title);
    }

}
